<?php 
include_once(''.P.'/public/header.html');
?>

<script type="text/javascript" src="res/js/jquery-changeuser.js"></script>

<script>
var fieldsarr = <?=json_encode($fieldsobj)?>;
function initbody(){
	
	
}
function save(o1){
	var da = js.getformdata(),fid,fd;
	for(fid in fieldsarr){
		fd = fieldsarr[fid];
		if(form(fid) && fd.isbt=='NO' && !da[fid]){
			js.setmsg(''+fd.name+'不能为空');
			form(fid).focus();
			return;
		}
	}
	
	js.setmsg('保存中...');
	o1.disabled=true;
	js.ajax({
		type:'post',
		url:'?m=usera&d=manage&cnum='+cnum+'&a=savecheck',
		data:da,
		success:function(res){
			if(res=='ok'){
				js.msgok('保存成功');
				js.back();
			}else{
				js.setmsg(res);
				o1.disabled=false;
			}
		}
	});
}
</script>
</head>

<body>

<?php 
include_once(''.P.'/public/top_manage.html');
?>

<div align="center">

<div style="width:<?=$maxwidth?>;margin:20px 0px" align="left">
	<div style="color:#cccccc">
		<a href="?d=manage&cnum=<?=$cnum?>" class="zhu"><?=lang('manage.home')?></a> &gt;
		<a href="javascript:;" onclick="js.back()" class="zhu"><?=lang('manage.usera')?></a> &gt;
		<a href="" class="zhu">人员操作</a>
	</div>
	<div class="mainbody">
		<div style="padding:20px" align="center">
			
			<form name="myform">
			<input type="hidden" name="id" value="<?=$data['id']?>">
			<table width="500px">
			
			<tr>
				<td align="right"><font color=red>*</font><?=$fieldsobj['name']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" name="name" class="input" value="<?=$data['name']?>"></td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			
			<tr>
				<td align="right"><?=$fieldsobj['pingyin']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:150px" name="pingyin" class="input" value="<?=$data['pingyin']?>">&nbsp;<font color="gray">方便搜索</font></td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			<tr>
				<td align="right"><?=$fieldsobj['gender']['name']?>&nbsp;&nbsp;</td>
				<td><select style="width:250px" name="gender" class="input">
				<?php
				foreach($fieldsobj['gender']['store'] as $k=>$v){
					$sel = '';
					if($data['gender']==$v[0])$sel = ' selected';
					echo '<option value="'.$v[0].'"'.$sel.'>'.$v[1].'</option>';
				}
				?>
				</select>
				</td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
		
			
			<tr>
				<td align="right"><font color=red>*</font><?=$fieldsobj['user']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" placeholder="字母数字组合" name="user" class="input" value="<?=$data['user']?>"></td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			<tr>
				<td align="right"><font color=red>*</font><?=$fieldsobj['mobile']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" maxlength="11" <?php if($data['uid']>0)echo 'readonly';?> name="mobile" class="input" value="<?=$data['mobile']?>"><?php 
				if($data['uid']>0)echo '<div style="font-size:12px"><font color=gray>已关注后用户自行修改</font></div>';
				?></td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			<tr>
				<td align="right"><?=$fieldsobj['email']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px" placeholder="单位分配的邮箱" name="email" class="input" value="<?=$data['email']?>"></td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			<tr>
				<td align="right"><?=$fieldsobj['tel']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px"  name="tel" class="input" value="<?=$data['tel']?>"></td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			<tr>
				<td colspan="2" height="30" align="right"><hr></td>
			</tr>
			
			<tr>
				<td align="right"><font color=red>*</font><?=$fieldsobj['deptname']['name']?>&nbsp;&nbsp;</td>
				<td>
					<input style="width:200px" readonly id="changedeptname" name="deptname" class="input" value="<?=$data['deptname']?>"><button type="button" class="webbtn" onclick="js.changeuser('changedeptname','dept','<?=$fieldsobj['deptname']['name']?>')">选择</button>
					<input type="hidden" name="deptid" id="changedeptname_id" class="input" value="<?=$data['deptid']?>">
				</td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
		
			<tr>
				<td align="right"><?=$fieldsobj['superman']['name']?>&nbsp;&nbsp;</td>
				<td>
					<input style="width:200px" readonly id="changesuperman" name="superman" class="input" value="<?=$data['superman']?>"><button type="button" class="webbtn"  onclick="js.changeuser('changesuperman','usercheck','<?=$fieldsobj['superman']['name']?>')">选择</button>
					<input type="hidden" name="superid" id="changesuperman_id" class="input" value="<?=$data['superid']?>">
				</td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			
			<tr>
				<td align="right"><?=$fieldsobj['position']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:250px"  name="position" class="input" value="<?=$data['position']?>"></td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			
			<tr>
				<td align="right"><?=$fieldsobj['type']['name']?>&nbsp;&nbsp;</td>
				<td><select style="width:250px" name="type" class="input">
				<?php
				foreach($fieldsobj['type']['store'] as $k=>$v){
					$sel = '';
					if($data['type']==$v[0])$sel = ' selected';
					echo '<option value="'.$v[0].'"'.$sel.'>'.$v[1].'</option>';
				}
				?>
				</select>
				</td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			<tr>
				<td align="right"><?=$fieldsobj['sort']['name']?>&nbsp;&nbsp;</td>
				<td><input style="width:150px" type="number" name="sort" class="input" value="<?=$data['sort']?>">
				<span style="color:gray">越小越靠前</span>
				</td>
			</tr>
			<tr><td colspan="2" height="10" align="right"></td></tr>
			
			<tr>
				<td align="right"></td>
				<td><button type="button" onClick="save(this)" style="padding:8px 20px;border-radius:5px" class="webbtn" >保存</button>&nbsp;<span id="msgview"><a href="javascript:;" onclick="js.back()">返回</a></span></td>
			</tr>
			</table>
			</form>
			
			
		</div>
	</div>
</div>



<?php 
include_once(''.P.'/public/footer.html');
?>
</div>

</body>
</html>